function sendOrderTableAjax(params,type,id,tableId,zhuID){
	$.ajax({
		url: localStorage.server_ip+''+CONFIG_PARAMS.app_path+'/clientAdaptor',
	  	dataType: 'xml',
	  	data:params,
		success:function(msg){
			if(type=="table")
				createOrderTable(msg,id,tableId);
			else if(type=="zhu")
				createOrderZhu(msg,id,zhuID);
			else if(type=="step")
				createOrderStepZhu(msg,id,zhuID);
		}
	});
}

function createOrderTable(msg,id,tableId){
	var data = {};
	data.title = [];
	data.rows = [];
		$(msg).find("fieldmap").children().each(function(i){
			var th_css="text_r";
			if(i==0){
				th_css="text_c";
			}
			var label = $(this).get(0).attributes.getNamedItem("name").nodeValue;
			var thead_tr_th = $("<th>").addClass(th_css).append($.trim(label));
			data.title.push(label);
		});
		$(msg).find("datas").children().each(function(i){
			var x=$(this).get(0).attributes.length;
			var list = [];
				for(var j=1;j<=x;j++){
					var td_css="text_r";
				 	var label = $(this).get(0).attributes.getNamedItem('col'+j).nodeValue;
				 	if(j==1){
						label=label.split(' ')[0];
						label=label.replace(/~/,'~<br>');				
						td_css="text_c";
					}
			  		list.push(label);
				}
				data.rows.push(list);
		});
		TABLETOOLS.createTable(data,id,"100%","100",[2,3,4,5,6,7,8],tableId);
}

function createOrderStepZhu(xml_data,id,zhuID){
	var div = $("<div>").attr("id",zhuID).addClass("graphCss");
	$(id).append(div).height($("#contentWarpper").height());
	var x_name=[];var data3=[];var data4=[];
	var size=$(id).parent().parent().data("highChartNum");
		$(xml_data).find("row").each(function(i){
			if(i+1>size && size!=0)
				return false;
			var col1=$(this).get(0).attributes.getNamedItem("col1").nodeValue;
			var col3=$(this).get(0).attributes.getNamedItem("col3").nodeValue;
			var col4=$(this).get(0).attributes.getNamedItem("col4").nodeValue;
			x_name.push(col1);
			data3.push(parseInt(col3));
			data4.push(parseInt(col4));
		});
		
        $('#'+zhuID).highcharts({
            chart: {
                type: 'column',
                backgroundColor:CONFIG_PARAMS.GraphBackColor
            },
            title: {
                text: ''
            },
            subtitle: {
                text: ''
            },
            xAxis: {
                categories: x_name,
	            labels : { 
            		style:{
            			color:CONFIG_PARAMS.GraphFontColor
            		}
            	}
            },
            yAxis: {
                title: {
                    text: '数量',
                    style:{
	            		color:CONFIG_PARAMS.GraphFontColor
	            	}
                },
                labels : { 
            		style:{
            			color:CONFIG_PARAMS.GraphFontColor
            		}
            	},stackLabels: {
                    enabled: true,
                    style: {
                        fontWeight: 'bold',
                        color: (Highcharts.theme && Highcharts.theme.textColor) || CONFIG_PARAMS.GraphFontColor
                    }
                }
            },
            legend:{
	        	itemStyle: {
                	color: CONFIG_PARAMS.GraphFontColor
            	},
            	labels : { 
            		style:{
            			color:CONFIG_PARAMS.GraphFontColor
            		}
            	}
	        },
	         tooltip: {
                shared: true
            },
            plotOptions: {
                column: {
                    stacking: 'normal',
                    dataLabels: {
                        enabled: true,
                        color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || CONFIG_PARAMS.GraphFontColor,
                		formatter:function(){
                			return this.y || "";
                		}
                    }
                }
            },
            series: [{
                name: '未过期',                
                data: data3,
                dataLabels: {
                    color:CONFIG_PARAMS.GraphFontColor
                }
            },{
            	name: '已过期',
                data: data4,
                dataLabels: {
                    color:CONFIG_PARAMS.GraphFontColor
                }
            }]
        });
}

function createOrderZhu(xml_data,id,zhuID){
	var div = $("<div>").attr("id",zhuID).addClass("graphCss");;
	$(id).append(div).height($("#contentWarpper").height());
	var x_name=[];var data1=[];var data2=[];var data4=[];
	var size=$(id).parent().parent().data("highChartNum");
		$(xml_data).find("row").each(function(i){
			if(i>size)
				return false;
			var col1=$(this).get(0).attributes.getNamedItem("col1").nodeValue;
			var col4,col5,col6;
			if(zhuID=="orderTotalZhuDiv"){
				col4=$(this).get(0).attributes.getNamedItem("col3").nodeValue;
			 	col5=$(this).get(0).attributes.getNamedItem("col5").nodeValue;
			 	col6=$(this).get(0).attributes.getNamedItem("col6").nodeValue;
			}else{
				col4=$(this).get(0).attributes.getNamedItem("col4").nodeValue;
			 	col5=$(this).get(0).attributes.getNamedItem("col6").nodeValue;
			 	col6=$(this).get(0).attributes.getNamedItem("col7").nodeValue;
			}
			col1=col1.split(' ')[0];
			col1=col1.split('~')[0];
			x_name.push(col1);
			data1.push(parseInt(col4));
			data2.push(parseInt(col5));
			data4.push(parseInt(col6));
		});
        $('#'+zhuID).highcharts({
            chart: {
                type: 'column',
                backgroundColor:CONFIG_PARAMS.GraphBackColor
            },
            title: {
                text: ''
            },
            subtitle: {
                text: ''
            },
            xAxis: {
                categories: x_name,
	            labels : { 
            		style:{
            			color:CONFIG_PARAMS.GraphFontColor
            		}
            	}
            },
            yAxis: {
                title: {
                    text: '数量',
                    style:{
	            		color:CONFIG_PARAMS.GraphFontColor
	            	}
                },
                labels : { 
            		style:{
            			color:CONFIG_PARAMS.GraphFontColor
            		}
            	},stackLabels: {
                    enabled: true,
                    style: {
                        fontWeight: 'bold',
                        color: (Highcharts.theme && Highcharts.theme.textColor) || CONFIG_PARAMS.GraphFontColor
                    }
                }
            },
            legend:{
	        	itemStyle: {
                	color: CONFIG_PARAMS.GraphFontColor
            	},
            	labels : { 
            		style:{
            			color:CONFIG_PARAMS.GraphFontColor
            		}
            	}
	        },
	         tooltip: {
                shared: true
            },
            plotOptions: {
                column: {
                    stacking: 'normal',
                    dataLabels: {
                        enabled: true,
                        color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || CONFIG_PARAMS.GraphFontColor,
                		formatter:function(){
                			return this.y || "";
                		}
                    }
                }
            },
            series: [{
                name: '已结案',
                data: data1,
                dataLabels: {
                    color:CONFIG_PARAMS.GraphFontColor
                }
            }, {
                name: '处理中未过期',
                data: data2,
                dataLabels: {
                    color:CONFIG_PARAMS.GraphFontColor
                }
            },{
            	name: '处理中已过期',
                data: data4,
                dataLabels: {
                    color:CONFIG_PARAMS.GraphFontColor
                }
            }]
        });
}